#pragma strict

var AFText : TextMesh;
var curAF : int;
var setAF : String;
var buttonColorTo : Color32;
var buttonColorFrom : Color32;
var colorSpeed : float;

function Start(){

	buttonColorTo = Color32(246,255,0,0);
	buttonColorFrom = Color32(150,150,150,0);	
	colorSpeed = 20;
	setAF = "Disabled";
	curAF = 0;
	
	renderer.material.SetColor("_Color", buttonColorFrom);

}

function Update(){

	AFText.GetComponent(TextMesh).text = "Anisotropic Filtering: "+setAF;

}

function OnMouseEnter() {

	iTween.ColorTo(gameObject, buttonColorTo, colorSpeed * Time.deltaTime);

}

function OnMouseExit() {

	iTween.ColorTo(gameObject, buttonColorFrom, colorSpeed * Time.deltaTime);

}

function OnMouseDown() {

	if(curAF == 2){
		curAF = 0;
	} else { 
		curAF += 1;
	}
	
	switch(curAF){
		case(0):
		//QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
		setAF = "Disabled";
		break;
		case(1):
		//QualitySettings.anisotropicFiltering = AnisotropicFiltering.Enable;
		setAF = "Enabled";
		break;
		case(2):
		//QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnabled;
		setAF = "Forced";
		break;
	}

}